//
//  NSString+Utils.m
//  LNPSRefProject
//
//  Created by yakun yin on 2017/6/14.
//  Copyright © 2017年 yakun yin. All rights reserved.
//

#import "NSString+Utils.h"

@implementation NSString (Utils)
- (NSString *)base64Encode{
    NSString *base64Encode = [[self dataUsingEncoding:NSUTF8StringEncoding] base64EncodedStringWithOptions:0];
    return base64Encode;
}
- (NSString *)base64Decode{
    NSString *base64Decode = [[NSString alloc] initWithData:[[NSData alloc] initWithBase64EncodedString:self options:0] encoding:NSUTF8StringEncoding];
    return base64Decode;
}

- (BOOL)isEmpty{
    if ( [self isEqualToString:@""] || self.length ==0 || self == nil){
        return YES;
    }
    else{
        return  NO;
    }
}

-(NSString *)URLDecode
{
    NSString *decodedString=(__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(NULL, (__bridge CFStringRef)self, CFSTR(""), CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding));
    return decodedString;
}

-(BOOL)isSame:(NSString *)str{
    BOOL isSame = NO;
    if ([self isEqualToString:str]) {
        isSame = YES;
    }
    return isSame;
}
@end
